home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / tspa3150.zip / TSUNTF.TST < prev    next >
Text File  |  1992-09-20  |  3KB  |  121 lines

  1. (* This is a test program for the TSUNTF.TPU unit
  2.    All rights reserved 19-Aug-89
  3.    Updated 23-Sep-89, 21-Mar-90, 20-Sep-92
  4. *)
  5.  
  6. uses Dos,
  7.      Crt,
  8.      TSUNTF;
  9.  
  10. procedure LOGO;
  11. begin
  12.   writeln;
  13.   writeln ('TSUNTF unit test by Prof. Timo Salmi, 20-Sep-92');
  14.   writeln ('University of Vaasa, Finland, ts@uwasa.fi');
  15.   writeln;
  16.   writeln ('....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....');
  17. end;  (* logo *)
  18.  
  19. (* Input line-editing *)
  20. procedure TEST1;
  21. var sj     : string;
  22.     prompt : string;
  23.     tmp    : string;
  24. begin
  25.   prompt := 'Give your input> ';
  26.   FillChar (tmp, SizeOf(tmp), '.');  { If you are wondering about these two, }
  27.   tmp[0] := chr(Length(prompt));     { they just produce points to show where}
  28.   repeat                             { we are.                               }
  29.     EDRDLN (prompt, sj);
  30.     writeln (tmp, sj);
  31.   until sj = 'exit';
  32. end;  (* test1 *)
  33.  
  34. (* Input line-editing with recall potential *)
  35. procedure TEST2;
  36. var sj     : string;
  37.     old    : string;
  38.     prompt : string;
  39. begin
  40.   prompt := 'Give your input> ';
  41.   old := '';
  42.   repeat
  43.     EDREADLN (prompt, old, sj);
  44.     writeln (sj);
  45.     old := sj;
  46.   until sj = 'exit';
  47. end;  (* test2 *)
  48.  
  49. (* Iput line-editing with recall and break potential *)
  50. procedure TEST3;
  51. var sj     : string;
  52.     old    : string;
  53.     prompt : string;
  54.     tmp    : string;
  55.     BreakPressed : boolean;
  56. begin
  57.   prompt := 'Give your input> ';
  58.   old := '';
  59.   repeat
  60.     EDREABLN (prompt, old, 79, sj, BreakPressed);
  61.     writeln (sj);
  62.     old := sj;
  63.   until BreakPressed;   {Press ctrl-c or break}
  64.   writeln ('Break was pressed');
  65. end;  (* test3 *)
  66.  
  67. (* Test input line-editing with recall and pre-fill potential.
  68.    Important, you must always assign a value to the PrefillString
  69.    before invoking this routine. Else you will have a random default
  70.    with unexpected results *)
  71. procedure TEST4;
  72. var sj      : string;
  73.     old     : string;
  74.     prompt  : string;
  75.     prefill : string;
  76. begin
  77.   prompt := 'Give your input> ';
  78.   prefill := 'Testing for the prefill';
  79.   old := prefill;
  80.   repeat
  81.     EDRDEFLN (prompt, old, prefill, sj);
  82.     prefill := '';
  83.     writeln (sj);
  84.     if sj <> '' then old := sj;
  85.   until sj = 'exit';
  86. end;  (* test4 *)
  87.  
  88. (* Test input line-editing with recall and pre-fill potential.
  89.    Important, you must always assign a value to the PrefillString
  90.    before invoking this routine. Else you will have a random default
  91.    with unexpected results *)
  92. procedure TEST5;
  93. var sj      : string;
  94.     old     : string;
  95.     prompt  : string;
  96.     prefill : string;
  97.     BreakPressed : boolean;
  98. begin
  99.   prompt := 'Give your input> ';
  100.   prefill := 'Testing for the prefill';
  101.   old := prefill;
  102.   repeat
  103.     EDRDEBLN (prompt, old, prefill, 79, sj, BreakPressed);
  104.     prefill := '';
  105.     writeln (sj);
  106.     if sj <> '' then old := sj;
  107.   until BreakPressed;   {Press ctrl-c or break}
  108.   writeln ('Break was pressed');
  109. end;  (* test5 *)
  110.  
  111. (* Main program *)
  112. begin
  113.   ClrScr;
  114.   LOGO;
  115.   { TEST1; }
  116.   { TEST2; }
  117.   { TEST3; }
  118.   TEST4;
  119.   { TEST5; }
  120. end.  (* tsuntf.tst *)
  121.